package com.market.xg.auth.web.config;

import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.DispatcherServlet;

import javax.servlet.MultipartConfigElement;

@Configuration
public class DispatcherRegistrationConfig {

    @Bean
    public ServletRegistrationBean dispatcherRegistration(DispatcherServlet dispatcherServlet, MultipartConfigElement multipartConfigElement){
        ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(dispatcherServlet);
        servletRegistrationBean.getUrlMappings().clear();
        servletRegistrationBean.setMultipartConfig(multipartConfigElement);
        servletRegistrationBean.addUrlMappings("/xg/api/auth/*");
        return servletRegistrationBean;

    }

}
